#include <cstdio>
#include <cstring>

class Lock {
public:
	Lock() {}
	~Lock() {}
	void AcquireLock() {}
	void ReleaseLock() {}
};

template <typename T> class Singleton {
	private:
		static Lock lock;
		static T* object;
	public:
		Singleton() {}
		static T* instance();
};

template <typename T>
Lock Singleton<T>::lock;

template <typename T>
T* Singleton<T>::object;

template <typename T>
T* Singleton<T>::instance() {
	if (object == NULL) {
		lock.AcquireLock();
		if (object == NULL) {
			object = new T();
		}
		lock.ReleaseLock();
	}
	return object;
}

int main() {
	return 0;
}

